package com.seleniti.enpareja.controller.model.integration.database.domain;

import javax.jdo.annotations.Column;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.jdo.annotations.Version;
import javax.jdo.annotations.VersionStrategy;
import javax.validation.constraints.NotNull;

import org.ioc.commons.domain.features.HasLabel;

import com.google.appengine.datanucleus.annotations.Unowned;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
@Version(column = "version", strategy = VersionStrategy.VERSION_NUMBER, extensions = { @Extension(vendorName = "datanucleus", key = "field-name", value = "version") })
public class CoupleRequest {

	public enum Status implements HasLabel {
		PENDING("Esperando su respuesta"), REJECTED("Rechazado");

		private String label;

		private Status(String label) {
			this.label = label;
		}

		@Override
		public String getLabel() {
			return label;
		}
	}

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String coupleRequestId;

	@Column(allowsNull = "false")
	@NotNull
	@Unowned
	private User from;

	@Column(allowsNull = "false")
	@NotNull
	private User to;

	@Column(allowsNull = "false")
	@NotNull
	private Status status;

	protected long version;

	public User getFrom() {
		return from;
	}

	public void setFrom(User from) {
		this.from = from;
	}

	public User getTo() {
		return to;
	}

	public void setTo(User to) {
		this.to = to;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	public long getVersion() {
		return version;
	}

	public void setVersion(long version) {
		this.version = version;
	}

	public String getCoupleRequestId() {
		return coupleRequestId;
	}

	public void setCoupleRequestId(String coupleRequestId) {
		this.coupleRequestId = coupleRequestId;
	}
}
